<template>
	<view>
		<view class="container u-skeleton">
			<view class="fgx">
			</view>
			<view class="form">
				<u-form :model="model" :rules="rules" ref="uForm" :errorType="errorType" :label-width="200">
					<u-form-item class="u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect" :required="required" :label-width="200" label="产业" prop="industry">
						<view style="width:100%;text-align: right;" @click="cySelect">{{model.industry || "请选择产业"}}</view>
					</u-form-item>
					<u-form-item class="u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect" :required="required" label-width="200" :label-position="labelPosition" label="姓名" prop="cardName">
						<u-input placeholder="请输入姓名" v-model="model.cardName" type="text" :input-align="inputAlign"></u-input>
					</u-form-item>
					<u-form-item class="u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect" :required="required" label-width="200" :label-position="labelPosition" label="毕业院校" prop="school">
						<u-input placeholder="请输入" v-model="model.school" type="text" :input-align="inputAlign"></u-input>
					</u-form-item>
					<view class="sctp u-p-t-40 u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect">
						<text class="hz">上传毕业证书<text class="sm u-skeleton-rect">(选填)</text></text>
						<text class="sm">无证书请上传身份证作为实名审核依据</text>
					</view>
					<u-form-item :label-position="labelPosition" prop="photo" label-width="150" class=" u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect">
						<u-upload ref="uUpload"  @on-uploaded="onUploadedZl" :custom-btn="customBtn" :show-upload-list="showUploadList"
						 :action="action" :auto-upload="autoUpload" :file-list="diplomas" @on-remove="onRemove" :show-progress="showProgress"
						 :deletable="deletable" max-count="1" :site="baseUrl">
							<view v-if="customBtn" slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
								<u-icon name="photo" size="60" :color="$u.color['lightColor']"></u-icon>
							</view>
						</u-upload>
					</u-form-item>
					<view class="sctp u-m-l-30 u-m-r-30 u-p-t-40 u-m-b-5 u-skeleton-rect">
						<text class="hz">上传身份证<text class="sm u-skeleton-rect">(选填)</text></text>
						<text class="sm">请上传身份证头像面和国徽面</text>
					</view>
					<u-form-item :label-position="labelPosition" prop="photo" label-width="150" class=" u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect">
						<u-upload ref="uUpload" @on-uploaded="onUploadedCard" :custom-btn="customBtn" :show-upload-list="showUploadList"
						 :action="action" :auto-upload="autoUpload" :file-list="cardIds" @on-remove="onRemove" :show-progress="showProgress"
						 :deletable="deletable" max-count="2" :site="baseUrl">
							<view v-if="customBtn" slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
								<u-icon name="photo" size="60" :color="$u.color['lightColor']"></u-icon>
							</view>
						</u-upload>
					</u-form-item>
					<u-form-item class="u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect" :required="required" :label-position="labelPosition" label="性别" label-width="345" prop="sex">
						<u-radio-group v-model="model.sex" @change="checkboxGroupChange" width="auto">
							<u-radio shape="square"  v-model="item.checked" v-for="(item, index) in sexList" :key="index" :name="item.name">{{ item.name }}</u-radio>
						</u-radio-group>
					</u-form-item>
					<u-form-item class="u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect" label="工作年限" prop="workingSeniority">
						<!-- <u-input  :disabled="disabled"  maxlength="2" placeholder="请输入工作年限" v-model="form.workingSeniority" input-align="right" /> -->
						<view style="width:100%;text-align: right;"  @click="showWorkingSeniority = true">{{model.workingSeniority || "请选择"}}</view>
						<u-picker
							mode="selector"
							v-model="showWorkingSeniority"
							@confirm="function (e){return nxconfirm(e,workingSenioritys,'workingSeniority')}"
							:range="workingSenioritys"
							range-key="label"
						></u-picker>
					</u-form-item>		
					<u-form-item class="u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect" :required="required" :label-width="200" label="个人身份" prop="userIdentify">
						<view style="width:100%;text-align: right;" @click="qySelect">{{model.userIdentify || "请选择"}}</view>
					</u-form-item>
					<u-form-item class="u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect" :required="required" :label-width="200" v-if="specialtyList != undefined" label="具体身份" prop="specialty">
						<view style="width:100%;text-align: right;" @click="showLB">{{model.specialty || "请选择"}}</view>
					</u-form-item>
					<u-form-item class="u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect" :required="required" :label-width="200" label="职称" prop="profession">
						<view v-if="specialtyList != undefined" class="value" style="width:100%;text-align: right;" @click="showProfession">{{model.profession || "请选择职称"}}</view>
						<u-input v-else disabled="disabled" placeholder="无" v-model="model.profession" input-align="right" />
						<u-picker v-if="specialtyList != undefined && specialtyList[specialtyKey] != undefined" mode="selector" v-model="professionShow" @confirm="function(e){return confirm(e,specialtyList[specialtyKey].jobTitle,'profession')}"
						 :range="specialtyList[specialtyKey].jobTitle"></u-picker>
						 <u-upload max-count="9"  @on-remove="onRemove" :custom-btn="true" :action="action" :show-upload-list="false" @on-success="avaUploadSuccess2">
							<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
								<image src="../../static/mine/homepage/upload.png" style="width: 48upx;height: 48upx;margin-left: 20upx;" />
							</view>
						 </u-upload>
					</u-form-item>
					<u-form-item class="u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect" v-if="proUrls != undefined && proUrls.length > 0" label="" prop="proUrl">
						<view  style="position: relative;" v-for="(item,index) in proUrls" :key="index">
							<image style="width: 214upx;height: 214upx;margin-right:30rpx;" :src="baseUrl+item"></image>
							<u-icon name="close-circle-fill" style="position: absolute;top: -16upx;right: 15rpx;font-size: 36upx;color: #f00;" 
							 @click="handleClearProUrl(index)"></u-icon>
						</view>
					</u-form-item>
					<u-form-item class="u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect" :required="required" :label-width="200" label="执业资格" prop="credentials">
						<view  v-if="specialtyList != undefined" class="value" style="width:100%;text-align: right;" @click="showCredentials">{{model.credentials || "请选择执业资格"}}</view>
						<u-input v-else disabled="disabled" placeholder="无" v-model="model.credentials" input-align="right" />
						<u-picker v-if="specialtyList != undefined && specialtyList[specialtyKey] != undefined" mode="selector" v-model="credentialsShow" @confirm="function(e){return confirm(e,specialtyList[specialtyKey].qualificationCert,'credentials')}"
						 :range="specialtyList[specialtyKey].qualificationCert"></u-picker>
						 <u-upload max-count="9" :custom-btn="true" :action="action" :show-upload-list="false" @on-success="avaUploadSuccess3">
							<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
								<image src="../../static/mine/homepage/upload.png" style="width: 48upx;height: 48upx;margin-left: 20upx;" />
							</view>
						 </u-upload>
					</u-form-item>
					<u-form-item class="u-m-l-30 u-m-r-30 line-break u-m-b-5 u-skeleton-rect" v-if="credentialsUrls !=undefined && credentialsUrls.length > 0" label="" prop="credentialsUrl"
					 :border-bottom="false">
						<view  style="position: relative;" v-for="(item,index) in credentialsUrls" :key="index">
							<image style="width: 214upx;height: 214upx;margin-right:30rpx;" :src="baseUrl+item"></image>
							<u-icon name="close-circle-fill" style="position: absolute;top: -16upx;right: 15rpx;font-size: 36upx;color: #f00;" 
							 @click="handleClearProUrl2"></u-icon>
						</view>
					</u-form-item>	
					<u-form-item class="u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect" :required="required" :label-width="200" label="擅长领域" prop="specials">
						<view style="width:100%;text-align: right;" @click="mSelect">{{model.specials || "请选择"}}</view>
					</u-form-item>
					<u-form-item class="u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect" :required="required" label-width="200" v-if="cy == 1135" label="专业方向" prop="professional">
						<view style="width:100%;text-align: right;" @click="zySelect">{{model.professional || "请选择"}}</view>
					</u-form-item>				
					
					<u-form-item class="u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect" :label-width="200" label="档期" prop="schedule" style="padding-bottom:10rpx;" :border-bottom="false">
						<view style="width:100%;text-align: right;" @click="show = true">{{model.schedule || "请选择"}}</view>
						<u-calendar v-model="show" ref="calendar" @change="change" :mode="mode"
							:start-text="startText" :end-text="endText" :range-color="rangeColor" max-date="2022-10-01"
							:range-bg-color="rangeBgColor" :active-bg-color="activeBgColor"
						>
						</u-calendar>
					</u-form-item>				
					<view class="u-p-l-30 u-p-r-30 u-p-b-30 u-border-bottom u-flex u-row-right  u-m-b-5 u-skeleton-rect">
						<text style="color: #9da2b0;">表示此段时间忙碌不接受新合作</text>
					</view>	
					<u-form-item class="u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect"  label-width="200" :label-position="labelPosition" label="工作单位" prop="workUnit">
						<u-input placeholder="请输入工作单位" v-model="model.workUnit" type="text" :input-align="inputAlign"></u-input>
					</u-form-item>
					<u-form-item class="u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect"  label-width="200" :label-position="labelPosition" label="工作地点" prop="workplace">
						<view style="width:100%;text-align: right;" @click="cityActive = true">{{model.workplace || "请选择"}}</view>
						<!-- <u-input type="select" :select-open="showCity" v-model="model.workplace" placeholder="请选择工作地点" placeholderStyle="color:#0D1D36" input-align="right" @click="showCity = true"></u-input>
						<u-select :default-value="defaultValue" v-model="showCity" mode="mutil-column-auto" value-name="value" label-name="name" child-name="submenu" :list="listCitys" @confirm="confirmCity"></u-select> -->
					</u-form-item>
					<u-form-item class="u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect"  :required="required" label-width="200" :label-position="labelPosition" label="联系电话" prop="telephone">
						<u-input placeholder="请输入手机号" v-model="model.telephone" type="text" :input-align="inputAlign"></u-input>
					</u-form-item>
					<u-form-item class="u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect"  :required="required" label-width="200" :label-position="labelPosition" label="邮箱" prop="mail">
						<u-input placeholder="请输入邮箱" v-model="model.mail" type="text" :input-align="inputAlign"></u-input>
					</u-form-item>
					<u-form-item class="u-m-l-30 u-m-r-30 u-m-b-5 u-skeleton-rect" label="自评标签" :label-width="150" prop="selfTag">
						<scroll-view class="scroll-view_H" scroll-x="true" scroll-left="0">
							<u-tag v-for="(item,index) in tagList" style="padding: 12upx 16upx;margin-right: 15upx;" :text="item" mode="plain"
							 :key="index" shape="circle" closeable @close="tagClick(index)" />
						</scroll-view>
						<u-button type="primary" style="height: 50upx;border-radius: 22upx;width: 120rpx;"
						 @click="popupActive = true">
							<u-icon name="plus"></u-icon>添加
						</u-button>
						<u-popup v-model="popupActive" mode="center">
							<view class="view-popup">
								<view style="margin-bottom: 20upx;">添加标签</view>
								<u-input v-model="tagValue" placeholder="请输入标签" :border="true" />
								<view style="display: flex;margin-top: 20upx;">
									<u-button style="height: 60upx;" @click="popupActive = false">取消</u-button>
									<u-button style="height: 60upx;" @click="handleAddTag" type="primary">确认</u-button>
								</view>
							</view>
						</u-popup>
					</u-form-item>
					<view class="sctp u-m-l-30 u-m-r-30 u-p-t-40 u-m-b-5 u-skeleton-rect">
						<text class="hz">自我评价</text>
					</view>
					<u-form-item class="  texts u-m-l-30 u-m-r-30  u-m-b-5 u-skeleton-rect" :label-position="labelPosition"  :border-bottom="false" prop="texts">
						<u-input  type="textarea" placeholder="请填写简介" v-model="model.texts" />
					</u-form-item>
				</u-form>
			</view>
			<view class="u-m-t-20 u-p-30 u-skeleton-rect">
				<u-button class="button" @click="submit">提交</u-button>
			</view>
		</view>
		
		<TriTree ref="cyTree" :multiple="false" :range="fetchDict.industry" @confirm="function (e){return setChooseType(e,'industry')}"></TriTree>
		<TriTree ref="triTree" :range="fetchDict.all_adept_field" @confirm="function (e){return scsetChooseType(e,'specials')}"></TriTree>
		<TriTree ref="zytriTree" :range="fetchDict.financing_cooperation_project_category" @confirm="function (e){return scsetChooseType(e,'professional')}"></TriTree>
		 <TriTree ref="qyTree" :range="fetchDict.company_type" @confirm="function (e){return scsetChooseType(e,'userIdentify')}"></TriTree>
		<u-picker mode="selector" v-model="specialtyShow" @confirm="function (e){return confirm(e,specialtyList,'specialty')}"
		 :range="specialtyList" :range-key="rangKey"></u-picker>
		 <!--引用组件-->
		 <u-skeleton :loading="loading" :animation="true" bgColor="#FFF"></u-skeleton>
		<city-select v-model="cityActive" @city-change="cityChange"></city-select>
	</view>
</template>

<script>
import citySelect from '@/components/u-city-select.vue';
export default {
	components:{
		citySelect
	},
		data(){
			return{	
				cityActive: false,
				loading: true, // 是否显示骨架屏组件
				show: false,
				mode: 'range',
				result: "请选择日期",
				startText: '开始',
				endText: '结束',
				rangeColor: '#2979ff',
				rangeBgColor: 'rgba(41,121,255,0.13)',
				activeBgColor: '#2979ff',
				diplomas:[],
				cardIds:[],
				customBtn: false,
				autoUpload: true,
				showProgress: false,	
				deletable: true,
				customStyle: false,
				maxCount: 1,
				lists: [], // 组件内部的文件列表
				filePaths: '', // 文件路径
				filePathsZl: '', // 文件路径
				filePathsZz: '', // 文件路径
				fileNames: '', // 文件名称	
				showUploadList: true,
				showUploadListZz: true,
				workingSenioritys:this.$mConstDataConfig.YearsService,
				showWorkingSeniority:false,
				/*个人选择产业*/
				identity:'个人身份',
				userIdentifyShow:false,
				userIdentifyList:[],
				mSelectShow: false,
				cy: '',
				specialtyShow: false,
				specialtyList: [],
				specialtyKey: '',
				rangKey: 'pname',
				professionShow: false,
				credentialsShow: false,
				rangKey: 'pname',
				fetchDict: [],
				/**/	
				baseUrl:this.$mConfig.baseUrl,
				logoMask: this.$mAssetsPath.logoMask,
				avatar:this.$mAssetsPath.avatar,
				action: this.$apis.uploadFile,
				identity:'个人身份',
				userIdentifyShow:false,
				userIdentifyList:[],
				professionValue:'',
				addprofessionActive:false,
				credentialsValue:'',
				addcredentialsActive:false,				
				//选择城市
				showCity: false,
				defaultValue: [3],
				listCitys:[],
				//自评标签
				tagValue: '',					
				popupActive: false,
				dqActive: false,
				schedule: {},
				tagList: [],
				sexList:[
					{
						name: '男',
						checked: false,
						disabled: false
					},
					{
						name: '女',
						checked: false,
						disabled: false
					},
					{
						name: '保密',
						checked: false,
						disabled: false
					},
				],
				model: {
					cardName: '',
					sex:0,
					school: '',
					specialty: '',
					profession:'',
					workingSeniority: '',
					credentials: '',
					workUnit: '',
					workplace: '',
					telephone: '',
					mail: '',
					texts: '',
					proUrl:'',
					credentialsUrl:''
				},
				rules: {
					cardName: [
						{
							required: true,
							message: '请输入姓名',
							trigger: 'blur' ,
						},
						{
							min: 2,
							max: 5,
							message: '姓名必须2~4个汉字以内',
							trigger: ['change','blur'],
						},
						{
							// 此为同步验证，可以直接返回true或者false，如果是异步验证，稍微不同，见下方说明
							validator: (rule, value, callback) => {
								// 调用uView自带的js验证规则，详见：https://www.uviewui.com/js/test.html
								return this.$u.test.chinese(value);
							},
							message: '姓名必须为中文',
							// 触发器可以同时用blur和change，二者之间用英文逗号隔开
							trigger: ['change','blur'],
						},
					],
					school: [
						{
							required: true,
							message: '请输入毕业院校',
							trigger: ['change','blur']
						}
					],
					sex: [
						{
							required: true,
							message: '请选择性别',
							trigger: 'change'
						}
					],		
					// profession: [
					// 	{
					// 		required: true,
					// 		message: '请选择职称',
					// 		trigger: ['change','blur']
					// 	}
					// ],
					telephone: [
						{
							required: true,
							message: '请输入联系电话',
							trigger: ['change','blur'],
						},
						{
							validator: (rule, value, callback) => {
								return this.$u.test.mobile(value);
							},
							message: '联系电话不正确',
							trigger: ['change','blur'],
						}
					],
					mail: [
						{
							required: true,
							message: '请输入邮箱',
							trigger: ['change','blur'],
						},
						{
							validator: (rule, value, callback) => {
								return this.$u.test.email(value);
							},
							message: '邮箱不正确',
							trigger: ['change','blur'],
						}
					]
				},	
				specialtyKey:'',
				specialtyShow: false,
				rangKey:'pname',
				specialtyList:[],
				professionShow:false,
				credentialsShow:false,
				selfTagShow:false,
				required: true,
				border: false,
				check: false,
				selectStatus: 'close',
				selectShowQyxz: false,
				selectShowZltx: false,
				selectShowScly: false,
				radio:'',
				inputAlign:'right',
				labelPosition: 'left',
				codeTips: '',
				errorType: ['toast'],
				uploadImageIndex: null,
				proUrls:[],
				credentialsUrls:[],
				infoList:[]
			}
		},
		onLoad(options){
			if(options.id){
				this.model.id = options.id
			}
			this.cityList();//选择地区
		},
		onReady() {
			this.$refs.uForm.setRules(this.rules);
		},
		onShow(){		
			var keys = {'keys':['industry','financing_cooperation_project_category','all_adept_field','company_type']}
			this.dictionaryFetchDict(keys);
			console.log('执行了');
			
			if(this.$store.state.userInfo.identityType !== undefined){
				this.getIdentitys();
			}
			
			this.getProfession(); //职称
		},
		methods:{				
			cityChange(e) {
				let address = e.province.label
				if(e.city){
					address = address + '-' + e.city.label;
				}
				if(e.area){
					address = address + '-' + e.area.label;
				}
				this.model.workplace = address
			},
			onRemove(index, lists) {
				 console.log('onRemove', index, lists);
				 this.fileList.splice(index, 1)
				 console.log(this.fileList);
				 this.filePaths = this.fileList;
			},
			qySelect() {
				this.$refs.qyTree._show()
			},
			change(e) {
				this.model.schedule = e.startDate + " - " + e.endDate;				
			},
			onUploadedZl(lists) {
				var filePaths = [],
					fileNames = [];
				for (let i in lists) {
					console.log('data', lists[i].response);
					if (lists[i].response.code == 200) {
						filePaths.push(lists[i].response.message);
					}
				}
				this.model.diploma = filePaths.join(',');
			},
			onUploadedCard(lists) {
				var filePaths = [],
					fileNames = [];
				for (let i in lists) {
					console.log('data', lists[i].response);
					if (lists[i].response.code == 200) {
						filePaths.push(lists[i].response.message);
					}
				}
				this.model.cardId = filePaths.join(',');
			},
			nxconfirm(e,list,type){
				var itemKey = e[0];
				this.model[type] = list[itemKey].value;				
			},
			/*个人选择产业*/
			showLB() {
				if (this.cy == '') {
					uni.showToast({
						title: "请先选择产业",
						icon: 'none'
					})
					return;
				}
				this.specialtyShow = true;
			},
			mSelectShowClick() {
				if (this.cy === '') {
					uni.showToast({
						title: "请先选择产业",
						icon: 'none'
					})
				} else {
					console.log("areaOfExpertise", this.specialtyList[this.specialtyKey].areaOfExpertise);
					this.mSelectShow = true;
				}
			},			
			mSelect() {
				this.$refs.triTree._show()
				this.$forceUpdate()
			},	
			zySelect() {
				this.$refs.zytriTree._show()
				this.$forceUpdate()
			},
			scsetChooseType(item, type) {
				console.log("column_array", item, type);
				var column_array = this.$mUtils.array_column(item, 'label');
				var modelValue = column_array.join(',');
				this.model[type] = modelValue;
				this.model[type + "List"] = item;
				this.$forceUpdate()
			},
			setChooseType(item, type) {
				var column_array = this.$mUtils.array_column(item, 'label');
				var modelValue = column_array.join(',');
				this.model[type] = modelValue;
				console.log("parents",JSON.stringify(item[0].parents));
				this.cy = item[0].parents.length > 0 ? item[0].parents[0].id : item[0].id;
				var cyValue = item[0].parents.length > 0?item[0].parents[0].label:item[0].label;
				console.log("cy",this.cy);
				
				this.getfetchProfessionById(this.cy);
				
				this.model.profession = '';
				this.model.credentials = '';
				this.model.expertise = '';
				this.model.specialty = '';
				this.$forceUpdate()
			},
			async getfetchProfessionById(id){
				let result = await this.$apis.fetchProfessionById({id:id});
				this.specialtyList = result.data;
				console.log("specialtyList",this.specialtyList);
				this.specialtyKey = 0;
			},
			cySelect() {
				this.$refs.cyTree._show()
			},			
			async getIdentitys(){
				let result = await this.$apis.identify({type:1});
				this.userIdentifyList = result.data;
			},			
			async dictionaryFetchDict(keyWords) {
				let result = await this.$apis.fetchMultipleKey(keyWords);
				if(result.code == 200){
					this.loading = false;
				}
				this.fetchDict = result.data;
				
				console.log("fetchDict",result.data);
			},
			/**/
			handleClearProUrl(e) {
				this.proUrls.splice(e,1);
			},
			handleClearProUrl2(e) {
				this.credentialsUrls.splice(e,1);
			},
			avaUploadSuccess(data) {
				console.log(data.message);
				this.model.imgUrl = data.message;
				//console.log(this.form.imgUrl)
			},
			avaUploadSuccess2(data) {
				this.proUrls.push(data.message);
				if(this.proUrls.length > 0) this.model.proUrl = this.proUrls.join(',');
				//console.log(this.form.proUrl)
			},
			avaUploadSuccess3(data) {
				this.credentialsUrls.push(data.message);	
				if(this.credentialsUrls.length > 0) this.model.credentialsUrl = this.credentialsUrls.join(',');			
				//console.log(this.form.credentialsUrl)
			},
			avaUploadSuccess4(data) {
				//console.log('this.uploadImageIndex', this.uploadImageIndex)
				//console.log('this.infoList', this.infoList)
				if (this.infoList[this.uploadImageIndex].imgUrl === '') {
					this.infoList[this.uploadImageIndex].imgUrl = data.message;
				} else {
					this.infoList[this.uploadImageIndex].imgUrl =this.infoList[this.uploadImageIndex].imgUrl+ ',' + data.message;
				}
			},
			async getIdentitys(){
				if(this.$store.state.userInfo.identityType !== undefined){
					let result = await this.$apis.identify({type:this.$store.state.userInfo.identityType});
					this.userIdentifyList = result.data;
				}
			},
			confirmCity(e) {
				this.model.workplace = '';
				e.map((val, index) => {
					this.model.workplace += this.model.workplace == '' ? val.label : '-' + val.label;
				})
			},
			async cityList(){
				let result = await this.$apis.fetchArea({level:2});	
				this.listCitys = result.data;
			},
			credentialsActive(){
				if(this.model.industry === ''){
					uni.showToast({
						title:"请先选择产业",
						icon:'none'
					})
				}else{
					this.addcredentialsActive = true;
				}
			},	
			async handleAddCredentials() {
				if (this.credentialsValue === '') {
					this.$refs.uToast.show({
						title: '职称不能为空',
						type: 'warning',
					})
				} else {					
					let saveData = this.specialtyList[this.specialtyKey];
					saveData.qualificationCert.push(this.credentialsValue);
					let result = await this.$apis.editProfession(saveData);								this.model.credentials = this.credentialsValue;
					this.credentialsValue = '';
					this.addcredentialsActive = false;
				}
			},
			
			professionActive(){
				if(this.model.industry === ''){
					uni.showToast({
						title:"请先选择产业",
						icon:'none'
					})
				}else{
					this.addprofessionActive = true;
				}
			},		
			async handleAddProfession() {				
				if (this.professionValue === '') {
					this.$refs.uToast.show({
						title: '职称不能为空',
						type: 'warning',
					})
				} else {					
					let saveData = this.specialtyList[this.specialtyKey];
					saveData.professionalDirectory.push(this.professionValue);
					let result = await this.$apis.editProfession(saveData);								this.model.profession = this.professionValue;
					this.professionValue = '';
					this.addprofessionActive = false;
				}
			},
			handleAddTag() {
				if (this.tagValue === '') {
					this.$refs.uToast.show({
						title: '标签不能为空',
						type: 'warning',
					})
				} else {
					this.tagList.push(this.tagValue);
					this.tagValue = '';
					this.popupActive = false;
				}
			},
			tagClick(e) {
				//console.log(e)
				this.tagList.splice(e, 1);
			},
			showProfession(){
				if(this.model.industry === ''){
					uni.showToast({
						title:"请先选择产业",
						icon:'none'
					})
				}else{
					this.professionShow = true;
				}
			},			
			showCredentials(){
				if(this.model.industry === ''){
					uni.showToast({
						title:"请先选择产业",
						icon:'none'
					})
				}else{
					this.credentialsShow = true;
				}
			},
			async getProfession(id){
				if(id){
					
					let result  = await this.$apis.fetchProfessionById({id:id});
					this.specialtyList = result.data;
				}		
			},
			confirm(e,list,type){
				if(type == 'specialty'){		
					var specialtyKey = e[0];
					this.specialtyKey = specialtyKey;			
					this.model[type] = list[e][this.rangKey];
				}else if(type == 'userIdentify'){	
					var itemKey = e[0];
					this.model[type] = list[itemKey]['name'];
				}else{
					var itemKey = e[0];
					this.model[type] = list[itemKey];
				}
					console.log("model:",this.model);
			},
			// checkbox选择发生变化
			checkboxGroupChange(e) {
				this.model.sex = e;							
			},
			// checkbox选择发生变化
			checkboxGroupChange1(e) {
				// this.model.jsyp = e;
				if(e==="是"){
					this.model.jsyp = 1;
				}else{
					this.model.jsyp = 0;
				}
			},
			submit() {
				console.log("industry",this.model.industry);
				if(this.model.industry == undefined){
					uni.showToast({
							title: "请先选择产业",
							icon: 'none'
					});
					return;
				}
				if(this.model.userIdentify == undefined){
					uni.showToast({
							title: "请先选择个人身份",
							icon: 'none'
					});
					return;
				}
				if(this.model.specialty == undefined){
					uni.showToast({
							title: "请先选择具体身份",
							icon: 'none'
					});
					return;
				}
				if(this.model.profession == undefined){
					uni.showToast({
							title: "请先选择职称",
							icon: 'none'
					});
					return;
				}
				if(this.model.credentials == undefined){
					uni.showToast({
							title: "请先选择执业资格",
							icon: 'none'
					});
					return;
				}
				if(this.model.specials == undefined){
					uni.showToast({
							title: "请先选择擅长领域",
							icon: 'none'
					});
					return;
				}
				this.$refs.uForm.validate(valid => {
					if(valid){this.save();}
				});
			},
			async save(){
				let data = await this.$apis.saveUserInfo(this.model);
				if(data.code == 200){					
					uni.showToast({
							title: "完善信息成功",
							icon: 'none'
					});
				}
				setTimeout(function(){
					uni.switchTab({
						url:'../tabBar/index'
					});
				},2000)			
			},
			selectConfirmQyxz(e) {
				this.model.qyxz = '';
				e.map((val, index) => {
					this.model.qyxz += this.model.qyxz == '' ? val.label : '-' + val.label;
				});
			},
			selectConfirmZltx(e) {
				this.model.zltx = '';
				e.map((val, index) => {
					this.model.zltx += this.model.zlxt == '' ? val.label : '-' + val.label;
				});
			},
			selectConfirmScly(e) {
				this.model.scly = '';
				e.map((val, index) => {
					this.model.scly += this.model.scly == '' ? val.label : '-' + val.label;
				});
			},
		},
		
	}
</script>

<style lang="scss" scoped>
	
		.slot-btn {
			display: flex;
			justify-content: center;
		}
	
	.fgx{
		// margin-top: 29rpx;
		// width: 100%;
		height: 20rpx;
		background-color: #F5F5F9;
	}
	.group {
		padding: 6rpx 21rpx;
		background: #f1f7ff;
		border-radius: 6rpx;
		margin: 30rpx 30rpx 0 30rpx;
	}
	.sctp{
		display: flex;
		flex-direction: column;
		.hz{
			color: #0D1D36;
			font-size: 30rpx;
		}
		.sm{
			color: #9DA2B0;
			font-size: 26rpx;
			line-height: 44rpx;
			margin-top: 38rpx;
		}
	}
	.gsdw{
		display: flex;
		justify-content: flex-end;
		align-items: center;
		margin-right: 34rpx;
		margin-top: 40rpx;
		.picture{
			width: 29rpx; height: 29rpx;
		}
		.hz{
			font-size: 30rpx;
			color: #0567FF;
			margin-left: 16rpx;
		}
	}
	.texts{
		width: 690rpx;
		height: 260rpx;
		background-color: #F5F5F9;
		margin-top: 40rpx;
		font-size: 30rpx;
		color: #F5F5F9;
		border-radius: 10rpx;
		line-height: 44rpx;
	}
	.button {
		width: 662rpx;
		margin:132rpx auto 70rpx auto;
		background: #ab61ff;
		border-radius: 40rpx;
		border: 0;
		color: #fff;
		&.u-hairline-border:after {
			border: 0;
		}
	}
	.form {
		.placeholderColor {
			color:#9DA2B0;
		}
	}
	.view-popup {
		padding: 30upx;
	}
</style>
